//-----------------------------------------------------------------------

// <copyright file="PasswordFieldDefinition.cs" company="Jamie Knight">

// Copyright (c) Jamie Knight. All rights reserved.

// </copyright>

//-----------------------------------------------------------------------

using System;
using System.Windows.Controls;
using System.Windows.Data;

namespace DevKnightlie.WPF.AutoForm.FieldDefinitions
{
    /// <summary>
    /// Field Definition class for a password field
    /// </summary>
    public class PasswordFieldDefinition : BaseFieldDefinition
    {
        #region Private Fields


        #endregion

        #region Properties


        #endregion

        #region Methods

        public override void BuildInputControl()
        {
            PasswordBox textBox = new PasswordBox()
            {
                VerticalContentAlignment = System.Windows.VerticalAlignment.Center,
                HorizontalContentAlignment = System.Windows.HorizontalAlignment.Left
            };
            Binding textBinding = new Binding(PropertyName);
            BindingOperations.SetBinding(textBox, TextBox.TextProperty, textBinding);
            SetupEnabledBinding(textBox);
            ContainerControl = InputControl = textBox;

        }

        #endregion
    }
}
